<div class="container-fluid">
    <div class="row-fluid">
        <div class="span4" style="top: 100px; font-family:Georgia">
            <h1 style="color:wheat">CCIS Report</h1>
            <table class="table">
                <thead>
                <tr>

                    <th>
                        Degree
                    </th>
                    <th>
                        Number of Faculty
                    </th>
                    <th>
                        Percentage
                    </th>
                </tr>
                </thead>
                <tbody>

                <?php

                $sum = 0;
                foreach ($table as $countRow) {
                    $sum += $countRow['count'];
                }

                foreach ($table as $row) {
                    ?>
                    <tr>
                        <td>
                            <?php echo $row['Description']; ?>
                        </td>

                        <td>
                            <?php echo $row['count']; ?>
                        </td>
                        <td>

                            <?php
                            echo number_format($row['count'] / $sum * 100, 2);
                            ?>%
                        </td>
                    </tr>
                <?php
                }
                ?>
                </tbody>
            </table>
            <b>Total Number of Faculty: <?php echo $sum ?></b>
        </div>
        <div class="span8">
            <div id="visualization" style="width: 852px; height: 600px;"></div>
            <!--<script type="text/javascript">
                //load package
                google.load('visualization', '1', {packages: ['corechart']});
            </script>-->
            <script type="text/javascript">
                function drawVisualization() {
                    // Create and populate the data table.
                    var data = google.visualization.arrayToDataTable
                        ([
                            ['Degree', 'Count'],
                            <?php
                                foreach($table as $row )
                                {
                                    $name = $row['Description'];
                                    $ratings = $row['count'];
                                    //extract($row);
                                    echo "['{$name}', {$ratings}],";
                                }
                            ?>
                        ]);

                    // Create and draw the visualization.
                    new google.visualization.PieChart($('#visualization')[0]).
                        draw(data, {title: "CCIS Percentage Distribution by Degree"});
                }

                google.setOnLoadCallback(drawVisualization);
            </script>
        </div>
    </div>
</div>